package self.hoy.demo.grainmall.ware;

import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;

@EnableDiscoveryClient
@EnableFeignClients
@SpringBootApplication
@EnableTransactionManagement
@MapperScan("self.hoy.demo.grainmall.ware.mapper")
public class GrainmallWareApplication {

    public static void main(String[] args) {
        SpringApplication.run(GrainmallWareApplication.class, args);
    }

    @Bean
    @LoadBalanced//使得 RestTemplate 接入 Ribbon
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }

    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
}
